package com.bingxue.edu.parent.controller;

import com.bingxue.edu.framework.common.model.Response;
import com.bingxue.edu.parent.model.query.StudentScheduleLessonQuery;
import com.bingxue.edu.parent.model.resp.StudentScheduleLessonResp;
import com.bingxue.edu.parent.model.resp.StudentScheduleLessonRespLegacy;
import com.bingxue.edu.parent.service.StudentScheduleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author panbo
 * @since 2024/11/7
 */
@Tag(name = "教师端小程序-排课模块")
@RestController
@RequestMapping("/p/schedule")
@RequiredArgsConstructor
public class StudentScheduleController extends ParentBaseController {

    private final StudentScheduleService studentScheduleService;


    @Deprecated
    @Operation(summary = "查询学生课次")
    @GetMapping("/lesson/list")
    public Response<List<StudentScheduleLessonRespLegacy>> getStudentLessonListLegacy(@Validated StudentScheduleLessonQuery query) {
        this.checkStudentRelation(query.getStudentId());
        List<StudentScheduleLessonRespLegacy> studentLessonList = studentScheduleService.getScheduleLessonListLegacy(query);
        return Response.success(studentLessonList);
    }

    @Operation(summary = "查询学生课次")
    @GetMapping("/lesson/query")
    public Response<List<StudentScheduleLessonResp>> getStudentLessonList(@Validated StudentScheduleLessonQuery query) {
        this.checkStudentRelation(query.getStudentId());
        List<StudentScheduleLessonResp> studentLessonList = studentScheduleService.getScheduleLessonList(query);
        return Response.success(studentLessonList);
    }

}
